<!DOCTYPE html> 
<html>
<head>
<meta charset="UTF-8" />
<title>15.2 message </title>
<script>
// Initialize the page function
function init() {
// set the button handler
var btnFindAll = document.getElementById('findAll');
btnFindAll.addEventListener('click',findAllContacts,false);
}
function findAllContacts()
{
var type = navigator.connection.type;
alert(type);
	if (navigator.device.sendMessage)
	{
		
		
		navigator.device.sendMessage('sms:+17705551212?body=Hi%20Tom');
	}else
	{
		alert("This device do not support the messsage");
	}
}
// Initialize the page on load
window.addEventListener('load',init,false);
</script>
</head>
<body>
<h1>send message</h1>
<button id="findAll" type="button" onclick="findAllContacts()">message </button>
<div id="divResults"></div>
</body>
</html>